package com.TeamJigsaw.DanteTrail.Models;

import java.util.Random;

/**
 * First nation giving something to the player.
 * @author Vince
 *
 */
public class GivingEvent extends RandomEvent {

	private Random generator;
	private String eventMessage;
	
	public GivingEvent(){
		generator = new Random();
		eventMessage = null;
	}
	
	@Override
	public boolean performEvent(Party party) {
		int randNum = generator.nextInt(101);
		int pace = party.getPace();
		double multiply = 0.00;
		if (pace == 5){
			multiply = 1.20;
		}
		else if (pace == 10){
			multiply = 1.15;
		}
		else if (pace == 15){
			multiply = 1.10;
		}
		else if (pace == 20){
			multiply = 1.05;
		}
		
		double newRand = randNum * multiply;
		
		if (newRand > 95){
			randNum = generator.nextInt(91) + 10;
			party.addFood(randNum);
			eventMessage = "A friendly wander ventured down from purgatory to give you " + randNum + " pounds of extra food.";
			return true;
		}
		
		return false;
	}

	@Override
	public String getMessage() {
		// TODO Auto-generated method stub
		return eventMessage;
	}

}
